package com.yq.utils;

import org.apache.ibatis.jdbc.SQL;
import org.apache.ibatis.session.SqlSession;
import org.apache.ibatis.session.SqlSessionFactory;
import org.apache.ibatis.session.SqlSessionFactoryBuilder;

import java.io.InputStream;

public class MybatisUtils {
    private MybatisUtils() {
    }
    static SqlSessionFactory factory;
    static {
    InputStream in = MybatisUtils.class.getClassLoader().getResourceAsStream("MapperConfig.xml");
     factory = new SqlSessionFactoryBuilder().build(in);
    }
public static SqlSession openSqlSession(){
    return factory.openSession();
}

}
